﻿

//初始化
if (typeof ($) != "undefined") {
    var fun = getPar1("fun");
    var vacationCode = "JQ1001";
    $(document).ready(function () {
        //获取提报人employeeId
        YAHOO.util.Connect.asyncRequest('POST', "../EHR/GetCurrentUser.aspx", {
            success: function (res) {
                try {
                    var str = res.responseText;
                    if (str != "-1") {
                        var token = str.split('_');
                        instance[0].EditWho = token[0];
                    }
                }
                catch (e) {
                }
                finally {

                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);

        //获取假期编码
        YAHOO.util.Connect.asyncRequest('POST', "../EHR/workTimeAjax.aspx?flag=vacationcode", {
            success: function (res) {
                try {
                    var str = res.responseText;
                    //debugger;
                    if (str != "-1") {
                        vacationCode = str;
                        if (fun == "add") {
                            $("#Code").val(vacationCode);
                        }
                    }
                }
                catch (e) { }
                finally { }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);

    });
    instance[0].EditDate = new Date();
    $("#Code").attr("disabled", true).css("background", "whitesmoke");
    if (fun == "add") {
        $("#DeductingMoneyRate").val(0);
        $("#MaxValue").val(-1);
        $("#MinValue").val(-1);
        $("#LeaveCount").val(-1);
        $("#LeaveMaxAge").val(-1);
        $("#LeaveMinAge").val(-1);
    }
    if (fun == "view") {
        parent.document.getElementById("yui-gen7-button").style.display = "none";
        $("div input").attr("disabled", true).css("background", "whitesmoke");
        $("div select ").attr("disabled", true).css("background", "whitesmoke");
    }
}

var fnCheckData = function () {
    try {
        if ($("#Name").val() == "") {
            return "假期名不能为空！";
        }
    }
    catch (e)
     { }
}

